__author__ = 'evenvi'
#!/usr/bin/env python
#Basic getaddrinfo() basic example -Chapter 4 - getaddrinfo-basic.py

import sys, socket

result = socket.getaddrinfo(sys.argv[1], None)

print result[0][4]

print "-------------more---------------"

counter = 0
for item in result:
    print "%-2d: %s " % (counter, item[4])
    counter += 1

print "-------------better---------------"

result2 = socket.getaddrinfo(sys.argv[1], None, 0, socket.SOCK_STREAM)


counter = 0
for item in result:
    print "%-2d: %s " % (counter, item[4])
    counter += 1

